<!--
 * @Descripttion:
 * @version:
 * @Author: zhuzm@linkstec.com
 * @Date: 2023-01-09 15:01:06
 * @LastEditors: sueRimn
 * @LastEditTime: 2023-02-10 09:52:58
-->
<template>
  <div class="search-list-activity">
    <div class="list-item" v-for="(item, index) in dataFilter" :key="index" @click="skipActivityDetail(item)">
      <h2 class="name" v-html="item.title_v"></h2>
    </div>
  </div>
</template>
<script>
import { verifyRoles } from '@/utils/verify';
export default {
  props: {
    data: {
      type: Array,
      default: () => {
        return [];
      }
    },
    max: {
      type: Number,
      default: Infinity
    }
  },
  computed: {
    dataFilter () {
      if (this.max === Infinity) return this.data;
      return this.data.slice(0, this.max);
    }
  },
  methods: {
    skipActivityDetail (item) {
      if (item.id === '16902') {
        window.location.href = process.env.VUE_APP_SERVICE_CP_HOMEACTIVITY;
        return;
      }
      if (!verifyRoles('research', 0)) {
        return;
      }
      window.location.href = process.env.VUE_APP_SERVICE_CP_HOMEACTIVITYDETAIL + '\\' + item.id;
    }
  }
};
</script>
<style lang="scss" scoped>
@import './common.scss';
.search-list-activity{
  .list-item{
    margin-bottom: 11px;
    display: flex;
  }
}
</style>
